package com.demo.service.impl;

import com.demo.entity.SsoUser;
import com.demo.entity.User;
import com.demo.service.SsoUserService;
import com.demo.utils.C3P0Utiles;
import com.demo.utils.TransactionMnanager;
import org.springframework.stereotype.Service;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * @author gy
 * @date 2023/3/16
 */
@Service
public class SsoUserServiceImpl implements SsoUserService {

    @Override
    public void addSsoUser(SsoUser ssoUser) {
        Connection conn=null;
        PreparedStatement ps=null;
        try {
            conn = TransactionMnanager.getConn();
            ps = conn.prepareStatement("insert into sso_user values(null,?,?,?)");
            ps.setString(1,ssoUser.getLoginId());
            ps.setString(2,ssoUser.getTrueName());
            ps.setString(3,ssoUser.getFkSiteId());
            ps.executeUpdate();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } finally {
            C3P0Utiles.close(null,ps,null);
        }

    }

    @Override
    public void querySsoUser() {

    }

    @Override
    public void delSsoUser() {

    }
}
